package com.tcl.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 *
 * @author gaodp
 */
@ConfigurationProperties(prefix = "http.client")
public class HttpClientProperties {

    private Connection connection;

    private Request request;


    public Connection getConnection() {
        return connection;
    }

    public void setConnection(Connection connection) {
        this.connection = connection;
    }

    public Request getRequest() {
        return request;
    }

    public void setRequest(Request request) {
        this.request = request;
    }

    public static class Connection {

        /**
         * 最大链接数
         */
        private int maxTotal;

        /**
         * 路由默认最大并发数
         */
        private int defaultMaxPerRoute;

        public int getMaxTotal() {
            return maxTotal;
        }

        public void setMaxTotal(int maxTotal) {
            this.maxTotal = maxTotal;
        }

        public int getDefaultMaxPerRoute() {
            return defaultMaxPerRoute;
        }

        public void setDefaultMaxPerRoute(int defaultMaxPerRoute) {
            this.defaultMaxPerRoute = defaultMaxPerRoute;
        }
    }

    public static class Request {
        /**
         * 从连接池中获取到连接的最长时间
         */
        private int connectionRequestTimeout;

        /**
         * 创建连接的最长时间
         */
        private int connectTimeout;

        /**
         * 数据传输的最长时间
         */
        private int socketTimeout;

        public int getConnectionRequestTimeout() {
            return connectionRequestTimeout;
        }

        public void setConnectionRequestTimeout(int connectionRequestTimeout) {
            this.connectionRequestTimeout = connectionRequestTimeout;
        }

        public int getConnectTimeout() {
            return connectTimeout;
        }

        public void setConnectTimeout(int connectTimeout) {
            this.connectTimeout = connectTimeout;
        }

        public int getSocketTimeout() {
            return socketTimeout;
        }

        public void setSocketTimeout(int socketTimeout) {
            this.socketTimeout = socketTimeout;
        }
    }
}
